<?php
/*
	
*/
defined('BY_JYA') or exit('Access Denied');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return['role']=$_SESSION['role'];
if($_RQ['op']=='main'){
	$member=cfc('core')->member_show($_SESSION['uid']);
	$mymember=pdo_get('jy_robshop_member',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$member=array_merge($member,$mymember);
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
	$member['ainum']=$this->count('feelog',array('type'=>15,'uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']));
	$return['member']=$member;
	$return['params']=array('type'=>0);
	$return['list']=array();
	set_html('title','我的机器人');
	exi($return);
}
if($_RQ['op']=='getlist'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']);
	$type=intval($_RQ['type']);
	if($type){
		$params['type']=15;	
	}
    $orderby='createtime desc';
	$total='';
	$table=$type?'jy_robshop_feelog':'jy_robshop_aiset';
	$return['list']=pdo_getslice($table,$params,array($pindex,$psize),$total,$fields,'',$orderby);	
	foreach($return['list'] as &$v){
		if($type==1){
			$teampaixu=pdo_getcolumn('jy_robshop_goods',array('id'=>$v['cangid'],'uniacid'=>$_SESSION['uniacid']),'paixu');
			$yaopaixu=pdo_getcolumn('jy_robshop_yao',array('id'=>$v['yaoid'],'uniacid'=>$_SESSION['uniacid']),'paixu');
			$v['createtime']=date('Y-m-d H:i:s',$v['createtime']);
			$v['statustitle']=$this->canlog_status[$v['status']];
			$v['typetitle']=$this->feelog_type[$v['type']];
			$v['title']='第'.$teampaixu.'抢购商品第'.$yaopaixu.''.$this->y_title;
		}else{
			$v['cang']=pdo_get('jy_robshop_goods',array('id'=>$v['cangid'],'uniacid'=>$_SESSION['uniacid']),array('title','id'));
			$v['statustitle']=$this->ai_status[$v['status']];
		}
	}
	exi($return);
}